// pages/wode/wode.js
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    xt_tj1:"color:#fff;background:#0b5fff",
    xt_tj2:"color:#0b5fff;background:none",
    yc_1:"display:block",
    yc_2:"display:none",
    isHide: false,
    AuthorizedLogin: '授权登录',
    UserPhone: '手机号授权',
    lee: "",
    flag: true,
    index_sj:"",
    shequ:"",
    sq_l:"display:none",
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
  },
  invoice(){
    wx.navigateTo({
      url: '../../classfiy/invoice/invoice',
    })
  },
  
  order(){
    wx.navigateTo({
      url: '../../classfiy/order/order',
    })
  },
  wf_ls(){
    wx.navigateTo({
      url: '../../classfiy/wf_ls/wf_ls',
    })
  },
  collect(){
    wx.navigateTo({
      url: '../../classfiy/collect/collect',
    })
  },
  set(){
    wx.navigateTo({
      url: '../../classfiy/set/set',
    })
  },
  xt_tj1:function(){
     var that = this;
     that.setData({
      xt_tj1:"color:#fff;background:#0b5fff",
      xt_tj2:"color:#0b5fff;background:none",
      yc_1:"display:block",
      yc_2:"display:none",
     })
  },
  moban(){
    wx.navigateTo({
      url: '../moban/moban',
    })
  },
  xt_tj2:function(){
    var that = this;
    that.setData({
     xt_tj2:"color:#fff;background:#0b5fff",
     xt_tj1:"color:#0b5fff;background:none",
     yc_1:"display:none",
     yc_2:"display:block",
    })
  },
  shimi_rz:function(){
    wx.navigateTo({
      url: '../shimingrenzheng/shimingrenzheng',
    })
  },
  wode_qm:function(){
    wx.navigateTo({
      url: '../wodeqian_m/wodeqian_m',
    })
  },
  qy_rz:function(){
    wx.navigateTo({
      url: '../qy_rz/qy_rz',
    })
     
  },
  qy_gz:function(){
    wx.navigateTo({
      url: '../qy_gz/qy_gz',
    })
  },
  wd_tx:function(){
    
    wx.navigateTo({
      url: '../tongxun_l/tongxun_l?chuan_s='+1+"&qianshu_id="+2,
    })
  },
  gr_xx:function(){
    wx.navigateTo({
      url: '../gr_xx/gr_xx',
    })
  },
  huiyuan_sq:function(){
    wx.navigateTo({
      url: '../huiyuan_sq/huiyuan_sq',
    })
  },
  chongzhi:function(){
    wx.navigateTo({
      url: '../zh_ye/zh_ye',
    })
  },
  moban_sh:function(e){
    var moban_sh = e.currentTarget.dataset.id; 
    wx.navigateTo({
      url: '../moban_sh/moban_sh?moban_sh='+moban_sh,
    })
  },
  moban_sh1:function(e){
    var moban_sh = e.currentTarget.dataset.id; 
    wx.navigateTo({
      url: '../moban_sh1/moban_sh1?moban_sh='+moban_sh,
    })
  },
  ht_jl:function(){
    wx.navigateTo({
      url: '../ht_moban/ht_moban',
    })
  },
  mb_tc:function(){
    wx.navigateTo({
      url: '../ht_moban1/ht_moban1',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // 获取用户信息
    var that = this;
    wx.request({
      url: app.globalData.url_l + 'api/index/shenhe',
      method: 'post',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
         console.log(res)
         if(res.data.shenhe==0){
          that.setData({
            ht_jl:"ht_jl"
          })
         
        }else  if(res.data.shenhe==1){
         that.setData({
           ht_jl:""
         })
        
       }
         that.setData({
           shenhe1:res.data.shenhe
         })
      }
    })
   
    
  },
  
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    if(app.globalData.sc==2){
      wx.showModal({
        title: '温馨提示',
        content:app.globalData.sc_ts,
        success (res) {
          if (res.confirm) {
            wx.switchTab({
              url: '../index/index',
            })
          } else if (res.cancel) {
            wx.switchTab({
              url: '../index/index',
            })
          }
        }
      })
    }
    wx.request({
      url: app.globalData.url_l + 'api/member/index',
      method: 'post',
      data:{
          uid:app.globalData.uid,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
        
         if(res.data.code==1){
          app.globalData.corpid = res.data.data.corpid
          app.globalData.gl_id =  res.data.data.type
           that.setData({
             ge_xx:res.data.data,
             qian1:res.data
           })
         }else{
          that.setData({
            ge_xx:'',
            qian1:''
          })
         }
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})